// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICloudTableClient.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   Exception for errors when handling Windows Azure Cloud Drives.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Data.Services.Client;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;

namespace AzureContrib.WindowsAzure.StorageClient
{
	/// <summary>
	/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient
	/// </summary>
	public interface ICloudTableClient
	{
		/// <summary>
		/// Gets the date time that Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.MinSupportedDateTime
		/// </summary>	
		DateTime MinSupportedDateTime { get; }

		/// <summary>
		/// Gets the <see cref="Uri"/> Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BaseUri
		/// </summary>
		Uri BaseUri { get; }
	
		/// <summary>
		/// Gets or sets the value that maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.RetryPolicy
		/// </summary>
		RetryPolicy RetryPolicy { get; set; }
		
		/// <summary>
		/// Gets or sets the value that maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.Timeout
		/// </summary>
		TimeSpan Timeout { get; set; }
		
		/// <summary>
		/// Gets the value that maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.Credentials
		/// </summary>
		StorageCredentials Credentials { get; }

		/// <summary>
		/// Gets the wrapped Microsoft.WindowsAzure.StorageClient.CloudTableClient.GetDataServiceContext
		/// </summary>
		/// <returns>
		/// The get data service context.
		/// </returns>
		TableServiceContext GetDataServiceContext { get; }

		/// <summary>
		/// Calls the wrapped Microsoft.WindowsAzure.StorageClient.CloudTableClient.CreateTablesFromModel
		/// </summary>
		/// <param name="serviceContextType">
		/// The service Context Type.
		/// </param>
		void CreateTablesFromModel(Type serviceContextType);

		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.Attach
		/// </summary>
		/// <param name="serviceContext">
		/// The service Context.
		/// </param>
		void Attach(DataServiceContext serviceContext);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginCreateTable
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin create table.
		/// </returns>
		IAsyncResult BeginCreateTable(string tableName, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndCreateTable
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		void EndCreateTable(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.CreateTable
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		void CreateTable(string tableName);
		
		/// <summary>
		/// Maps to Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginCreateTableIfNotExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <param name="callback">
		/// The callback method.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The Maps to Microsoft.WindowsAzure.StorageClient.IAsyncResult for the begin create table.
		/// </returns>
		IAsyncResult BeginCreateTableIfNotExist(string tableName, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndCreateTableIfNotExist
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		/// <returns>
		/// The end create table if not exist.
		/// </returns>
		bool EndCreateTableIfNotExist(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.CreateTableIfNotExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <returns>
		/// The create table if not exist.
		/// </returns>
		bool CreateTableIfNotExist(string tableName);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginDoesTableExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin does table exist.
		/// </returns>
		IAsyncResult BeginDoesTableExist(string tableName, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndDoesTableExist
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		/// <returns>
		/// The end does table exist.
		/// </returns>
		bool EndDoesTableExist(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.DoesTableExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <returns>
		/// The does table exist.
		/// </returns>
		bool DoesTableExist(string tableName);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.ListTables()
		/// </summary>
		/// <returns>
		/// The list tables.
		/// </returns>
		IEnumerable<string> ListTables();
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.ListTables(string)
		/// </summary>
		/// <param name="prefix">
		/// The prefix.
		/// </param>
		/// <returns>
		/// The list tables.
		/// </returns>
		IEnumerable<string> ListTables(string prefix);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.ListTablesSegmented()
		/// </summary>
		/// <returns>
		/// The list tables segmented.
		/// </returns>
		ResultSegment<string> ListTablesSegmented();
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.ListTablesSegmented(int,ResultContinuation)
		/// </summary>
		/// <param name="maxResults">
		/// The max Results.
		/// </param>
		/// <param name="continuationToken">
		/// The continuation Token.
		/// </param>
		/// <returns>
		/// The list tables segmented.
		/// </returns>
		ResultSegment<string> ListTablesSegmented(int maxResults, ResultContinuation continuationToken);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.ListTablesSegmented(string,int,ResultContinuation)
		/// </summary>
		/// <param name="prefix">
		/// The prefix.
		/// </param>
		/// <param name="maxResults">
		/// The max Results.
		/// </param>
		/// <param name="continuationToken">
		/// The continuation Token.
		/// </param>
		/// <returns>
		/// The list tables segmented.
		/// </returns>
		ResultSegment<string> ListTablesSegmented(string prefix, int maxResults, ResultContinuation continuationToken);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginListTablesSegmented(AsyncCallback,object)
		/// </summary>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin list tables segmented.
		/// </returns>
		IAsyncResult BeginListTablesSegmented(AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginListTablesSegmented(string,AsyncCallback,object)
		/// </summary>
		/// <param name="prefix">
		/// The prefix.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin list tables segmented.
		/// </returns>
		IAsyncResult BeginListTablesSegmented(string prefix, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginListTablesSegmented(string,int,ResultContinuation,AsyncCallback,object)
		/// </summary>
		/// <param name="prefix">
		/// The prefix.
		/// </param>
		/// <param name="maxResults">
		/// The max Results.
		/// </param>
		/// <param name="continuationToken">
		/// The continuation Token.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin list tables segmented.
		/// </returns>
		IAsyncResult BeginListTablesSegmented(string prefix, int maxResults, ResultContinuation continuationToken, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndListTablesSegmented
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		/// <returns>
		/// The end list tables segmented.
		/// </returns>
		ResultSegment<string> EndListTablesSegmented(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginDeleteTable
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin delete table.
		/// </returns>
		IAsyncResult BeginDeleteTable(string tableName, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndDeleteTable
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		void EndDeleteTable(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.DeleteTable
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		void DeleteTable(string tableName);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.BeginDeleteTableIfExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <param name="callback">
		/// The callback.
		/// </param>
		/// <param name="state">
		/// The state.
		/// </param>
		/// <returns>
		/// The begin delete table if exist.
		/// </returns>
		IAsyncResult BeginDeleteTableIfExist(string tableName, AsyncCallback callback, object state);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.EndDeleteTableIfExist
		/// </summary>
		/// <param name="asyncResult">
		/// The async Result.
		/// </param>
		/// <returns>
		/// The end delete table if exist.
		/// </returns>
		bool EndDeleteTableIfExist(IAsyncResult asyncResult);
		
		/// <summary>
		/// Maps to Microsoft.WindowsAzure.StorageClient.CloudTableClient.DeleteTableIfExist
		/// </summary>
		/// <param name="tableName">
		/// The table Name.
		/// </param>
		/// <returns>
		/// The delete table if exist.
		/// </returns>
		bool DeleteTableIfExist(string tableName);
	}
}